Imports Clo = Enhancements.Core.Logging
Imports Fun = Enhancements.Basic.Expressions.Functions
Imports Ref = System.Reflection
Imports Sys = System

Namespace Enhancements.Basic.Expressions
    ''' <summary>The exception that is thrown when an expression contains different counts of begin delimiters and end delimiters.</summary>
    <Serializable(), DebuggerStepThrough()> _
    Public NotInheritable Class CompilerExpressionLevelsDelimitersCountAreEqualNotException
        Inherits CompilerException

        Private Sub New(ByVal _expression As System.String, ByVal _delimitersBeginCount As Sys.Int32, ByVal _delimitersEndCount As Sys.Int32)
            Expression = _expression
            DelimitersBeginCount = _delimitersBeginCount
            DelimitersEndCount = _delimitersEndCount
        End Sub

        Private __Expression As System.String = Nothing
        ''' <summary>Gets the expression that caused this exception.</summary>
        Public Property Expression() As System.String
            Get
                Return __Expression
            End Get
            Private Set(ByVal _value As System.String)
                __Expression = _value
            End Set
        End Property

        Private __DelimitersBeginCount As System.Int32 = 0
        ''' <summary>Gets the begin delimiters count that caused this exception.</summary>
        Public Property DelimitersBeginCount() As System.Int32
            Get
                Return __DelimitersBeginCount
            End Get
            Private Set(ByVal _value As System.Int32)
                __DelimitersBeginCount = _value
            End Set
        End Property

        Private __DelimitersEndCount As System.Int32 = 0
        ''' <summary>Gets the end delimiters count that caused this exception.</summary>
        Public Property DelimitersEndCount() As System.Int32
            Get
                Return __DelimitersEndCount
            End Get
            Private Set(ByVal _value As System.Int32)
                __DelimitersEndCount = _value
            End Set
        End Property

        ''' <summary>Throws an exception.</summary>
        ''' <param name="_expression">Expression that is causing the exception.</param>
        ''' <param name="_delimitersBeginCount">Begin delimiters count that is causing the exception.</param>
        ''' <param name="_delimitersEndCount">End delimiters count that is causing the exception.</param>
        ''' <exception cref="CompilerExpressionLevelsDelimitersCountAreEqualNotException"> </exception>
        Friend Shared Sub ___Throw(ByVal _expression As System.String, ByVal _delimitersBeginCount As Sys.Int32, ByVal _delimitersEndCount As Sys.Int32)
            Dim _exception As CompilerExpressionLevelsDelimitersCountAreEqualNotException = New CompilerExpressionLevelsDelimitersCountAreEqualNotException(_expression, _delimitersBeginCount, _delimitersEndCount)

            Throw _exception
        End Sub

    End Class
End Namespace
